// https://pinia.vuejs.org/
import { createPinia, defineStore } from 'pinia';
import { ref } from "vue";
import { getProductCateList,  getProductAttriList } from '/@/api/main/busProduct';

// 创建
// const productCate = productCatePinia();
// const productAttri = productAttriPinia();

const productCateRowList = ref<any>([]);
const getProductCateLst = async (value: any) => {
        let list = await getProductCateList({ p1: value });
        productCateRowList.value = list.data.result ?? [];
 };

const productAttrList = ref<any>([]);
const getProductAttriLst = async (value: any) => {
    let list = await getProductAttriList({ p1: value });
    productAttrList.value = list.data.result ?? [];
};

// 导出
export const productCate = defineStore('pCate',{    
    state: () => {
        return {
            productCateRowList
        };
      },
});

export const productAttri = defineStore('pAttri',{ 
    state: () => {
        return {
            productAttrList
        };
      },
});
